﻿using Microsoft.AspNetCore.Http;
using FrameWork;

namespace System.Web.Mvc
{
   public class SessionHelper
   {
        /// <summary>
        /// 添加Session，调动有效期为20分钟
        /// </summary>
        /// <param name="strSessionName">Session对象名称</param>
        /// <param name="strValue">Session值</param>
        public static void Set(string strSessionName, string strValue)
        {
            TimHttpContext.Context?.Session?.SetString(strSessionName, strValue);
        }

        /// <summary>
        /// 读取某个Session对象值
        /// </summary>
        /// <param name="strSessionName">Session对象名称</param>
        /// <returns>Session对象值</returns>
        public static string Get(string strSessionName)
        {
            return TimHttpContext.Context?.Session?.GetString(strSessionName) ?? "";
        }
    }
}
